package com.zy.design.state;

/**
 * @author hugx
 * @create 2018-09-13 10:21
 */
public class StopDoorState implements LiftState {
    private StateContext context;

    @Override
    public void setStateConetxt(StateContext context) {
        this.context = context;
    }

    @Override
    public void openDoor() {
        context.setLiftState(context.openDoorState);
        context.getLiftState().openDoor();
    }

    @Override
    public void closeDoor() {
        context.setLiftState(context.closeDoorState);
        context.getLiftState().closeDoor();
    }

    @Override
    public void runing() {
        context.setLiftState(context.runingDoorState);
        context.getLiftState().runing();
    }

    /**
     * 在关闭stop状态下，电梯可以执行open,runing,close 操作
     */
    @Override
    public void stop() {
        System.out.println("电梯停止");
    }
}
